package com.formula.datastructure.exercise.search;

public class HashTable4 implements HashTable {
    private HashNode[] array;

    public HashTable4() {
        array = new HashNode[50];
    }

    public HashTable4(int size) {
        array = new HashNode[size];
    }

    // 直接定址法
    @Override
    public int hash(int key) {
        // 线性关系
        int address = 2 * key + 1;

        // 开放定址法-线性探查法
        while (array[address] != null) {
            address = address + 1;
        }
        return address;
    }

    @Override
    public void put(HashNode node) {

    }

    @Override
    public HashNode get(int key) {
        return null;
    }
}
